//
//  XCHVideoView.swift
//  视频悬浮框Swift
//
//  Created by 解楚豪 on 2018/9/18.
//  Copyright © 2018年 xch. All rights reserved.
//

import UIKit

extension XCHVideoView {

    convenience init(_ videoUrl : String,_ frame:CGRect) {
        self.init(frame: frame)
        videoPlay(videoUrl: videoUrl)
    }
}

class XCHVideoView: UIView {
    
    var videoUrl:String?
    override init(frame: CGRect) {
        super.init(frame: frame)
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    func videoPlay(videoUrl:String) {
        XCHPlayObject.shareInstance().videoUrl = videoUrl
        XCHPlayObject.shareInstance().frame = self.bounds
        XCHPlayObject.shareInstance().supperAddView(supView: self)
        XCHPlayObject.shareInstance().videoPlay()
    }

}
